﻿ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using ATSIDAL;
using ATSModel;
using ATSModel.T_ReportInfo;

namespace ATSDAL
{
    public class TRPeport : BaseRepository<TRPeportInfo>, ITPTReport
    {
        private const string PARM_TESTITEM_STRATDATE = "@starttime";
        private const string PARM_TESTITEM_ENDDATE = "@stoptime";
        private const string PARM_TESTITEM_PRODUCTSN = "@productSN";
        private const string PARM_TESTITEM_MO = "@MOID";


        public IList<TRPeportInfo> LoadEntities()
        {
            return null;
        }

        public TRPeportInfo LoadEntity<T1>(T1 Id)
        {
            return null;
        }

        // 根据MO号获取交调数据 

        public IList<TRPeportInfo> PIMData_ByMOS(string MOID)
        {
            SqlParameter[] testItemParms = GetSNTParameters(PARM_TESTITEM_MO);
            testItemParms[0].Value = MOID;

            return ExcuteSqlToGetEntities("ATS_TestReportByMo", testItemParms);
        }


        #region 参数部分

        private static SqlParameter[] GetSNTParameters(string Par)
        {
            SqlParameter[] parms = null;
            parms = new SqlParameter[]
                {
					new SqlParameter(Par, SqlDbType.Text),           
                };
            return parms;
        }
        #endregion

        #region 重写基类部分
        //-------------------------------------重写超类基础操作---------------------------------------------------------

        public override TRPeportInfo GetEntityRecord(SqlDataReader rdr)
        {
            TRPeportInfo pro = new TRPeportInfo
            {
                ProductTypeID = rdr.GetValue(0).ToString(),
                MOID = rdr.GetValue(1).ToString(),
                ProductSN = rdr.GetValue(2).ToString(),
                RecordTime = rdr.GetValue(3).ToString(),
                TestTypeName = rdr.GetValue(4).ToString(),
                TestBand = rdr.GetValue(5).ToString(),
                TestAngle = rdr.GetValue(6).ToString(), 
                TestItemName = rdr.GetValue(7).ToString(),
                TestResult = rdr.GetValue(8).ToString(),  
                TND = rdr.GetValue(9).ToString()

            };
            return pro;
        }

        #endregion  
 
    }
}



